package com.example.jdcompetition.Controller;

import com.example.jdcompetition.Component.CsvPaths;
import com.example.jdcompetition.Entity.CallResultMsg;
import com.example.jdcompetition.Service.cvsPro.jd.SaveData;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import static com.example.jdcompetition.JdcompetitionApplication.*;
/**
 * @author henrydai
 * @date 2021/6/17 15:18
 */

@RestController
@Slf4j
public class SolveDataController {

    @Autowired
    private SaveData saveData;
    @Autowired
    private CsvPaths paths;

    @GetMapping(value = "/savedata",produces = "application/json")
    public CallResultMsg solve()
    {
        synchronized (obj)
        {
            log.info("接收处理文件请求");
            return saveData.saveAll(paths);
        }

    }
}
